package cn.hls.service.impl;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import cn.hls.dao.EmergencyDao;
import cn.hls.entity.Emergency;
import cn.hls.entity.vo.PageInfo;
import cn.hls.service.EmergencyService;

/**
  *@fileName: EmergencyServiceBean.java
  *@package: cn.hls.service.impl
　*@Description:应急预案业务逻辑接口实现类
　*@author: yinghui.zhang
　*@email: uuhui@163.com
  *@date: 2016年12月17日
 *
 */
@Service("emergencyService")
public class EmergencyServiceBean extends BaseServiceBean<Emergency> implements
		EmergencyService {

	@Resource(name="emergencyDao")
	private EmergencyDao dao;
	 
	@Override
	public boolean update(Emergency entity) throws Exception {
		Emergency tempEntity=dao.find(entity.getId());
		Date createTime=tempEntity.getCreateTime();
		BeanUtils.copyProperties(entity, tempEntity);
		tempEntity.setCreateTime(createTime);
		tempEntity.setUpdateTime(new Date());
		return super.update(tempEntity);
	}
	 
	@Override
	public boolean exists(Emergency entity) throws Exception {
		return dao.exists(entity);
	}

	@Override
	public PageInfo<Emergency> loadEmergencyInfo(PageInfo<Emergency> page,
			Emergency entity) throws Exception {
		return dao.loadEmergencyInfo(page, entity);
	}
 
}
